package com.tensquare.user.dao;

import com.tensquare.user.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by WF on 2020/10/23 11:23
 */
public interface UserDao extends JpaRepository<User,String> {
    
    //1.根据手机号查询用户
    User findByMobile(String mobile);

    //2.增加粉丝数
    @Modifying
    @Query(nativeQuery=true,value="update tb_user set fanscount=fanscount+?2 where id=?1")
    void incfans(String friendid, int n);


    //3.增加关注数
    @Modifying
    @Query(nativeQuery=true,value="update tb_user set followcount=followcount+?2 where id=?1")
    void incfollow(String userid, int n);
}
